import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ProductFeatureDetailsVO, ProductFeatureDetailsForm, ProductFeatureDetailsQuery } from '@/api/system/productFeatureDetails/types';

/**
 * 查询产品特性详情，存储特性的详细说明列表
 * @param query
 * @returns {*}
 */

export const listProductFeatureDetails = (query?: ProductFeatureDetailsQuery): AxiosPromise<ProductFeatureDetailsVO[]> => {
  return request({
    url: '/system/productFeatureDetails/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询产品特性详情，存储特性的详细说明详细
 * @param id
 */
export const getProductFeatureDetails = (id: string | number): AxiosPromise<ProductFeatureDetailsVO> => {
  return request({
    url: '/system/productFeatureDetails/' + id,
    method: 'get'
  });
};

/**
 * 新增产品特性详情，存储特性的详细说明
 * @param data
 */
export const addProductFeatureDetails = (data: ProductFeatureDetailsForm) => {
  return request({
    url: '/system/productFeatureDetails',
    method: 'post',
    data: data
  });
};

/**
 * 修改产品特性详情，存储特性的详细说明
 * @param data
 */
export const updateProductFeatureDetails = (data: ProductFeatureDetailsForm) => {
  return request({
    url: '/system/productFeatureDetails',
    method: 'put',
    data: data
  });
};

/**
 * 删除产品特性详情，存储特性的详细说明
 * @param id
 */
export const delProductFeatureDetails = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/productFeatureDetails/' + id,
    method: 'delete'
  });
};
